﻿namespace Agent
{
    using System;
    using System.CodeDom.Compiler;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Diagnostics;
    using System.Globalization;
    using System.Linq;
    using System.Runtime.CompilerServices;
    using System.Text.RegularExpressions;
    using System.Threading;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Input;
    using System.Windows.Markup;
    using System.Windows.Media.Imaging;
    using System.Windows.Shapes;
    using TheSafety.Management;

    [GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
    public class ManagementWindow : Window, IComponentConnector
    {
        private bool a;
        internal Image a0;
        internal Button a1;
        internal Button a2;
        internal TabItem a3;
        internal StackPanel a4;
        internal Image a5;
        private bool a6;
        [CompilerGenerated]
        private static Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool> a7;
        [CompilerGenerated]
        private static SendOrPostCallback a8;
        [CompilerGenerated]
        private static ThreadStart a9;
        internal Image aa;
        internal Rectangle ab;
        internal Label ac;
        internal Label ad;
        internal Label ae;
        internal TextBox af;
        internal PasswordBox ag;
        internal Image ah;
        internal Image ai;
        internal GroupBox aj;
        internal Label ak;
        internal Label al;
        internal StackPanel am;
        internal Label an;
        internal Label ao;
        internal StackPanel ap;
        internal Label aq;
        internal Label ar;
        internal StackPanel @as;
        internal Label at;
        internal Label au;
        internal StackPanel av;
        internal Label aw;
        internal Label ax;
        internal TextBlock ay;
        internal Label az;
        private bool b;
        [CompilerGenerated]
        private static Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool> ba;
        [CompilerGenerated]
        private static Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool> bb;
        [CompilerGenerated]
        private static Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool> bc;
        [CompilerGenerated]
        private static Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool> bd;
        [CompilerGenerated]
        private static Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool> be;
        private string c = "";
        private SynchronizationContext d;
        private ManagementPromoItem e;
        internal TabControl f;
        internal TabItem g;
        internal Label h;
        internal Image i;
        internal GroupBox j;
        internal Rectangle k;
        internal Label l;
        internal RadioButton m;
        internal RadioButton n;
        internal RadioButton o;
        internal Label p;
        internal Rectangle q;
        internal StackPanel r;
        internal Label s;
        internal CheckBox t;
        internal Label u;
        internal ComboBox v;
        internal Label w;
        internal ComboBox x;
        internal Label y;
        internal TextBox z;

        public ManagementWindow()
        {
            this.InitializeComponent();
            this.f();
            this.e();
        }

        [CompilerGenerated]
        private void <InitSubscribtions>b__28(object A_0, MouseButtonEventArgs A_1)
        {
            <>c__DisplayClass35 class2;
            this.a4.Children.Clear();
            CancelItemNew a = new CancelItemNew();
            this.a4.Children.Add(a);
            a.c((A_0 as SubscriptionItem).d());
            a.b((A_0 as SubscriptionItem).h());
            a.e((A_0 as SubscriptionItem).f());
            a.d((A_0 as SubscriptionItem).e());
            a.b(new EventHandler<RoutedEventArgs>(class2.c));
        }

        [CompilerGenerated]
        private void <InitSubscribtions>b__2a(object A_0, MouseButtonEventArgs A_1)
        {
            <>c__DisplayClass37 class2;
            this.a4.Children.Clear();
            ChangeItemNew a = new ChangeItemNew();
            this.a4.Children.Add(a);
            a.c((A_0 as SubscriptionItem).d());
            a.b((A_0 as SubscriptionItem).h());
            a.d((A_0 as SubscriptionItem).e());
            a.e((A_0 as SubscriptionItem).f());
            a.f((A_0 as SubscriptionItem).i());
            a.b(new EventHandler<RoutedEventArgs>(class2.c));
        }

        [CompilerGenerated]
        private void <InitSubscribtions>b__2d(object A_0, MouseButtonEventArgs A_1)
        {
            <>c__DisplayClass3a classa;
            this.a4.Children.Clear();
            ProlongItemNew a = new ProlongItemNew();
            a.c((A_0 as SubscriptionItem).d());
            a.d((A_0 as SubscriptionItem).f());
            a.b((A_0 as SubscriptionItem).h());
            a.e((A_0 as SubscriptionItem).e());
            this.a4.Children.Add(a);
            a.b(new EventHandler<RoutedEventArgs>(classa.c));
        }

        [CompilerGenerated]
        private static void a()
        {
            Process.Start("https://thesafety.us/billing/?key=" + WebRequestManager.e("balance"));
        }

        [CompilerGenerated]
        private static bool a(KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> A_0)
        {
            return (A_0.Key.c() == "standard");
        }

        private void a(List<UniObj<string, string, string, string, string, string, string>> A_0)
        {
            EventHandler<MouseButtonEventArgs> handler = null;
            EventHandler<MouseButtonEventArgs> handler2 = null;
            EventHandler<MouseButtonEventArgs> handler3 = null;
            this.a4.Children.Clear();
            if (A_0 == null)
            {
                Label element = new Label {
                    Content = e.c("There are no subscriptions in your account!")
                };
                this.a4.Children.Add(element);
            }
            else
            {
                string[] source = ConfigManager.c(ConfigManager.q() + "/config");
                using (List<UniObj<string, string, string, string, string, string, string>>.Enumerator enumerator = A_0.GetEnumerator())
                {
                    Func<string, bool> predicate = null;
                    UniObj<string, string, string, string, string, string, string> a;
                    while (enumerator.MoveNext())
                    {
                        a = enumerator.Current;
                        SubscriptionItem item = new SubscriptionItem();
                        item.d(a.c());
                        item.c(a.a());
                        item.e(a.f());
                        if (predicate == null)
                        {
                            <>c__DisplayClass33 class2;
                            predicate = new Func<string, bool>(class2.b);
                        }
                        source.Where<string>(predicate).ToList<string>();
                        item.i(a.e());
                        item.b(a.b());
                        item.g(a.g());
                        item.f(a.d());
                        this.a4.Children.Add(item);
                        if (handler == null)
                        {
                            handler = new EventHandler<MouseButtonEventArgs>(this.<InitSubscribtions>b__28);
                        }
                        item.e(handler);
                        if (handler2 == null)
                        {
                            handler2 = new EventHandler<MouseButtonEventArgs>(this.<InitSubscribtions>b__2a);
                        }
                        item.f(handler2);
                        if (handler3 == null)
                        {
                            handler3 = new EventHandler<MouseButtonEventArgs>(this.<InitSubscribtions>b__2d);
                        }
                        item.c(handler3);
                    }
                }
            }
        }

        [CompilerGenerated]
        private void a(object A_0)
        {
            this.a4.IsEnabled = true;
        }

        [DebuggerNonUserCode, EditorBrowsable(EditorBrowsableState.Never)]
        private void a(int A_0, object A_1)
        {
            switch (A_0)
            {
                case 1:
                    ((ManagementWindow) A_1).Loaded += new RoutedEventHandler(this.Window_Loaded);
                    return;

                case 2:
                    this.f = (TabControl) A_1;
                    this.f.SelectionChanged += new SelectionChangedEventHandler(this.tabs_SelectionChanged);
                    return;

                case 3:
                    this.g = (TabItem) A_1;
                    return;

                case 4:
                    this.h = (Label) A_1;
                    return;

                case 5:
                    this.i = (Image) A_1;
                    this.i.MouseLeftButtonUp += new MouseButtonEventHandler(this.imgRefresh_MouseLeftButtonUp);
                    return;

                case 6:
                    this.j = (GroupBox) A_1;
                    return;

                case 7:
                    this.k = (Rectangle) A_1;
                    return;

                case 8:
                    this.l = (Label) A_1;
                    return;

                case 9:
                    this.m = (RadioButton) A_1;
                    this.m.Click += new RoutedEventHandler(this.rStVPN_Click);
                    return;

                case 10:
                    this.n = (RadioButton) A_1;
                    this.n.Click += new RoutedEventHandler(this.rVipN_Click);
                    return;

                case 11:
                    this.o = (RadioButton) A_1;
                    return;

                case 12:
                    this.p = (Label) A_1;
                    return;

                case 13:
                    this.q = (Rectangle) A_1;
                    return;

                case 14:
                    this.r = (StackPanel) A_1;
                    return;

                case 15:
                    this.s = (Label) A_1;
                    return;

                case 0x10:
                    this.t = (CheckBox) A_1;
                    this.t.Click += new RoutedEventHandler(this.chkDedicatedIP_Click);
                    return;

                case 0x11:
                    this.u = (Label) A_1;
                    return;

                case 0x12:
                    this.v = (ComboBox) A_1;
                    this.v.SelectionChanged += new SelectionChangedEventHandler(this.OnSubscribtion_SelectionChanged);
                    return;

                case 0x13:
                    this.w = (Label) A_1;
                    return;

                case 20:
                    this.x = (ComboBox) A_1;
                    this.x.SelectionChanged += new SelectionChangedEventHandler(this.OnSubscribtion_SelectionChanged);
                    return;

                case 0x15:
                    this.y = (Label) A_1;
                    return;

                case 0x16:
                    this.z = (TextBox) A_1;
                    this.z.KeyUp += new KeyEventHandler(this.txtPromo_KeyUp);
                    return;

                case 0x17:
                    this.aa = (Image) A_1;
                    return;

                case 0x18:
                    this.ab = (Rectangle) A_1;
                    return;

                case 0x19:
                    this.ac = (Label) A_1;
                    return;

                case 0x1a:
                    this.ad = (Label) A_1;
                    return;

                case 0x1b:
                    this.ae = (Label) A_1;
                    return;

                case 0x1c:
                    this.af = (TextBox) A_1;
                    this.af.KeyUp += new KeyEventHandler(this.txtLogin_KeyUp);
                    return;

                case 0x1d:
                    this.ag = (PasswordBox) A_1;
                    this.ag.KeyUp += new KeyEventHandler(this.txtPass_KeyUp);
                    return;

                case 30:
                    this.ah = (Image) A_1;
                    return;

                case 0x1f:
                    this.ai = (Image) A_1;
                    return;

                case 0x20:
                    this.aj = (GroupBox) A_1;
                    return;

                case 0x21:
                    this.ak = (Label) A_1;
                    return;

                case 0x22:
                    this.al = (Label) A_1;
                    return;

                case 0x23:
                    this.am = (StackPanel) A_1;
                    return;

                case 0x24:
                    this.an = (Label) A_1;
                    return;

                case 0x25:
                    this.ao = (Label) A_1;
                    return;

                case 0x26:
                    this.ap = (StackPanel) A_1;
                    return;

                case 0x27:
                    this.aq = (Label) A_1;
                    return;

                case 40:
                    this.ar = (Label) A_1;
                    return;

                case 0x29:
                    this.@as = (StackPanel) A_1;
                    return;

                case 0x2a:
                    this.at = (Label) A_1;
                    return;

                case 0x2b:
                    this.au = (Label) A_1;
                    return;

                case 0x2c:
                    this.av = (StackPanel) A_1;
                    return;

                case 0x2d:
                    this.aw = (Label) A_1;
                    return;

                case 0x2e:
                    this.ax = (Label) A_1;
                    return;

                case 0x2f:
                    this.ay = (TextBlock) A_1;
                    return;

                case 0x30:
                    this.az = (Label) A_1;
                    return;

                case 0x31:
                    this.a0 = (Image) A_1;
                    this.a0.MouseLeftButtonUp += new MouseButtonEventHandler(this.imgPayment_MouseLeftButtonUp);
                    return;

                case 50:
                    this.a1 = (Button) A_1;
                    this.a1.Click += new RoutedEventHandler(this.btnBuy_Click);
                    return;

                case 0x33:
                    this.a2 = (Button) A_1;
                    this.a2.Click += new RoutedEventHandler(this.btnCancel_Click);
                    return;

                case 0x34:
                    this.a3 = (TabItem) A_1;
                    return;

                case 0x35:
                    this.a4 = (StackPanel) A_1;
                    return;

                case 0x36:
                    this.a5 = (Image) A_1;
                    return;
            }
            this.a6 = true;
        }

        private void b()
        {
            new Thread(new ParameterizedThreadStart(this.c)) { IsBackground = true }.Start(null);
        }

        [CompilerGenerated]
        private static bool b(KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> A_0)
        {
            return (A_0.Key.c() == "standardip");
        }

        [CompilerGenerated]
        private void b(object A_0)
        {
            this.a4.IsEnabled = false;
        }

        private void btnBuy_Click(object A_0, RoutedEventArgs A_1)
        {
            string str = "gui";
            string str2 = "0";
            string str3 = "";
            string str4 = "";
            string key = "";
            if (this.o.IsChecked.HasValue && this.o.IsChecked.Value)
            {
                str = "gui";
            }
            else if (this.m.IsChecked.HasValue && this.m.IsChecked.Value)
            {
                str = "standard";
                if (!this.a)
                {
                    MessageBox.Show(e.c("For Username VPN uses only symbols a-z and 0-9, it should be 6-15 symbols in length."));
                    return;
                }
                if (!this.b)
                {
                    MessageBox.Show(e.c("For Password VPN uses only symbols a-z and 0-9, it should be 6-15 symbols in length."));
                    return;
                }
            }
            else if (this.n.IsChecked.HasValue && this.n.IsChecked.Value)
            {
                str = "vipn";
                if (!this.a)
                {
                    MessageBox.Show(e.c("For Username VPN uses only symbols a-z and 0-9, it should be 6-15 symbols in length."));
                    return;
                }
                if (!this.b)
                {
                    MessageBox.Show(e.c("For Password VPN uses only symbols a-z and 0-9, it should be 6-15 symbols in length."));
                    return;
                }
            }
            if ((this.t.IsChecked.HasValue && this.t.IsChecked.Value) && this.t.IsEnabled)
            {
                str2 = "1";
            }
            if (this.v.SelectedItem != null)
            {
                KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> tag = (KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>) (this.v.SelectedItem as ComboBoxItem).Tag;
                str3 = tag.Key.b();
                KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> pair2 = (KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>) (this.v.SelectedItem as ComboBoxItem).Tag;
                str4 = pair2.Key.b();
            }
            if (this.x.SelectedItem != null)
            {
                KeyValuePair<string, ManagementPromoItemPeriod> pair3 = (KeyValuePair<string, ManagementPromoItemPeriod>) (this.x.SelectedItem as ComboBoxItem).Tag;
                key = pair3.Key;
            }
            string[] parameter = new string[] { str, str2, str4, key, str3, this.c, this.af.Text, this.ag.Password };
            new Thread(new ParameterizedThreadStart(this.l)) { IsBackground = true }.Start(parameter);
        }

        private void btnCancel_Click(object A_0, RoutedEventArgs A_1)
        {
            base.Close();
        }

        private void c()
        {
            if (this.x.SelectedItem != null)
            {
                float num = 0f;
                float num2 = 0f;
                KeyValuePair<string, ManagementPromoItemPeriod> tag = (KeyValuePair<string, ManagementPromoItemPeriod>) (this.x.SelectedItem as ComboBoxItem).Tag;
                float num3 = float.Parse(tag.Value.a());
                this.al.Content = num3.ToString() + " USD";
                KeyValuePair<string, ManagementPromoItemPeriod> pair2 = (KeyValuePair<string, ManagementPromoItemPeriod>) (this.x.SelectedItem as ComboBoxItem).Tag;
                num2 = float.Parse(pair2.Value.b());
                this.ao.Content = Convert.ToString(num2) + " %";
                if (num2 != 0f)
                {
                    this.am.Visibility = Visibility.Visible;
                }
                else
                {
                    this.am.Visibility = Visibility.Collapsed;
                }
                if (!string.IsNullOrWhiteSpace(this.c))
                {
                    num = float.Parse(this.c);
                }
                this.ar.Content = this.c + " %";
                if (num != 0f)
                {
                    this.ap.Visibility = Visibility.Visible;
                }
                else
                {
                    this.ap.Visibility = Visibility.Collapsed;
                }
                float num4 = (num3 * (1f - (num2 / 100f))) * (1f - (num / 100f));
                if (this.e.b() != null)
                {
                    num4 -= float.Parse(this.e.b(), new CultureInfo("en-US"));
                }
                if (num4 < 0f)
                {
                    this.ax.Content = "0 (?)";
                    this.av.ToolTip = e.c("TotalToolTip");
                }
                else
                {
                    this.ax.Content = num4.ToString("F", new CultureInfo("en-US")) + " USD";
                    this.av.ToolTip = "";
                }
                float num5 = float.Parse(this.e.a(), new CultureInfo("en-US"));
                if (num4 > num5)
                {
                    this.ay.Visibility = Visibility.Visible;
                }
                else
                {
                    this.ay.Visibility = Visibility.Collapsed;
                }
            }
        }

        [CompilerGenerated]
        private static bool c(KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> A_0)
        {
            return (A_0.Key.c() == "vipn");
        }

        [CompilerGenerated]
        private void c(object A_0)
        {
            <>c__DisplayClass24 class2;
            this.d.Send(new SendOrPostCallback(this.b), null);
            List<UniObj<string, string, string, string, string, string, string>> a = WebRequestManager.b();
            this.d.Send(new SendOrPostCallback(class2.c), null);
            this.d.Send(new SendOrPostCallback(this.a), null);
        }

        private void chkDedicatedIP_Click(object A_0, RoutedEventArgs A_1)
        {
            this.v.Items.Clear();
            if ((A_0 as CheckBox).IsChecked.HasValue && (A_0 as CheckBox).IsChecked.Value)
            {
                bool flag = false;
                if (bd == null)
                {
                    bd = new Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool>(ManagementWindow.b);
                }
                foreach (KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> pair in this.e.c().Where<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>>(bd))
                {
                    ComboBoxItem newItem = new ComboBoxItem {
                        Content = pair.Key.a(),
                        Tag = pair
                    };
                    this.v.Items.Add(newItem);
                    if (!flag)
                    {
                        this.v.SelectedIndex = 0;
                        flag = true;
                    }
                }
            }
            else
            {
                bool flag2 = false;
                if (be == null)
                {
                    be = new Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool>(ManagementWindow.a);
                }
                foreach (KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> pair2 in this.e.c().Where<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>>(be))
                {
                    ComboBoxItem item2 = new ComboBoxItem {
                        Content = pair2.Key.a(),
                        Tag = pair2
                    };
                    this.v.Items.Add(item2);
                    if (!flag2)
                    {
                        this.v.SelectedIndex = 0;
                        flag2 = true;
                    }
                }
            }
        }

        private void d()
        {
            if ((this.e != null) && (this.e.c().Count > 0))
            {
                this.x.IsEnabled = true;
                this.v.IsEnabled = true;
                this.af.IsEnabled = true;
                this.ag.IsEnabled = true;
                this.z.IsEnabled = true;
                this.w.IsEnabled = true;
                this.u.IsEnabled = true;
                this.y.IsEnabled = true;
                this.ad.IsEnabled = true;
                this.ae.IsEnabled = true;
                this.a1.IsEnabled = true;
                if ((AgentUser.a().b() == LicenseType.Premium) || (AgentUser.a().b() == LicenseType.Limited))
                {
                    bool flag = false;
                    foreach (KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> pair in this.e.c())
                    {
                        ComboBoxItem newItem = new ComboBoxItem {
                            Content = pair.Key.a(),
                            Tag = pair
                        };
                        this.v.Items.Add(newItem);
                        if (!flag)
                        {
                            this.v.SelectedIndex = 0;
                            flag = true;
                        }
                    }
                }
                else
                {
                    bool flag2 = false;
                    if (a7 == null)
                    {
                        a7 = new Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool>(ManagementWindow.f);
                    }
                    foreach (KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> pair2 in this.e.c().Where<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>>(a7))
                    {
                        ComboBoxItem item2 = new ComboBoxItem {
                            Content = pair2.Key.a(),
                            Tag = pair2
                        };
                        this.v.Items.Add(item2);
                        if (!flag2)
                        {
                            this.v.SelectedIndex = 0;
                            flag2 = true;
                        }
                    }
                }
                this.c();
            }
            else
            {
                this.x.IsEnabled = false;
                this.v.IsEnabled = false;
                this.af.IsEnabled = false;
                this.ag.IsEnabled = false;
                this.z.IsEnabled = false;
                this.w.IsEnabled = false;
                this.u.IsEnabled = false;
                this.y.IsEnabled = false;
                this.ad.IsEnabled = false;
                this.ae.IsEnabled = false;
                this.a1.IsEnabled = false;
            }
        }

        [CompilerGenerated]
        private static bool d(KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> A_0)
        {
            return (A_0.Key.c() == "standard");
        }

        [CompilerGenerated]
        private void d(object A_0)
        {
            this.f.IsEnabled = true;
        }

        private void e()
        {
            if (AgentUser.a().b() == LicenseType.Elite)
            {
                this.a3.Visibility = Visibility.Visible;
                this.r.Visibility = Visibility.Visible;
                this.o.Visibility = Visibility.Hidden;
                this.m.Visibility = Visibility.Visible;
                this.n.Visibility = Visibility.Visible;
                this.m.IsChecked = true;
                this.s.IsEnabled = true;
                this.t.IsEnabled = true;
                this.ab.Visibility = Visibility.Visible;
                this.ac.Visibility = Visibility.Visible;
                this.ad.Visibility = Visibility.Visible;
                this.ae.Visibility = Visibility.Visible;
                this.af.Visibility = Visibility.Visible;
                this.ag.Visibility = Visibility.Visible;
            }
            else
            {
                if (AgentUser.a().b() == LicenseType.Limited)
                {
                    this.a3.Visibility = Visibility.Hidden;
                }
                this.r.Visibility = Visibility.Collapsed;
                this.o.Visibility = Visibility.Visible;
                this.m.Visibility = Visibility.Hidden;
                this.n.Visibility = Visibility.Hidden;
                this.o.IsChecked = true;
                this.s.IsEnabled = false;
                this.t.IsEnabled = false;
                this.ab.Visibility = Visibility.Hidden;
                this.ac.Visibility = Visibility.Hidden;
                this.ad.Visibility = Visibility.Hidden;
                this.ae.Visibility = Visibility.Hidden;
                this.af.Visibility = Visibility.Hidden;
                this.ag.Visibility = Visibility.Hidden;
            }
            this.ap.Visibility = this.@as.Visibility = this.am.Visibility = this.ay.Visibility = Visibility.Collapsed;
        }

        [CompilerGenerated]
        private static bool e(KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> A_0)
        {
            return (A_0.Key.c() == "standardip");
        }

        [CompilerGenerated]
        private void e(object A_0)
        {
            this.h.Content = e.c("YourBalance") + ":  " + this.e.a() + " $";
        }

        private void f()
        {
            this.h.Content = e.c("YourBalance");
            this.az.Content = e.c("AddFunds") + ":";
            this.ac.Content = e.c("ChooseLoginPass") + ":";
            this.p.Content = e.c("ChooseTheSubscribtion") + ":";
            this.s.Content = e.c("DedicatedIP") + ":";
            this.ad.Content = e.c("UsernameVPN") + ":";
            this.ae.Content = e.c("PasswordVPN") + ":";
            this.w.Content = e.c("Period") + ":";
            this.y.Content = e.c("PromoCode") + ":";
            this.u.Content = e.c("OneSubscribtion") + ":";
            this.l.Content = e.c("SubscriptionType") + ":";
            this.ak.Content = e.c("Cost") + ":";
            this.aq.Content = e.c("Promo") + ":";
            this.an.Content = e.c("Discount") + ":";
            this.at.Content = e.c("MoneyReturn") + ":";
            this.aw.Content = e.c("Total") + ":";
            this.g.Header = e.c("Order");
            this.a3.Header = e.c("Subscribtion");
            this.j.Header = e.c("OrderInfo");
            this.aj.Header = e.c("Sum");
            this.ay.Text = e.c("NotEnoughMoney");
            this.a1.Content = e.c("BuySubscribtion");
            this.a2.Content = e.c("Cancel");
            this.al.Content = this.al.Content.ToString() + " USD";
            this.ao.Content = this.ao.Content.ToString() + " USD";
            this.ax.Content = this.ax.Content.ToString() + " USD";
            base.Title = e.c("ManagementWindowTitle");
            this.o.Content = e.c("GUILicense");
        }

        [CompilerGenerated]
        private static bool f(KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> A_0)
        {
            return (A_0.Key.c() == "standard");
        }

        [CompilerGenerated]
        private void f(object A_0)
        {
            SendOrPostCallback d = null;
            string str = WebRequestManager.c();
            if (str != null)
            {
                this.e.a(str);
                if (d == null)
                {
                    d = new SendOrPostCallback(this.e);
                }
                this.d.Send(d, null);
            }
            this.d.Send(new SendOrPostCallback(this.d), null);
        }

        [CompilerGenerated]
        private void g(object A_0)
        {
            this.f.IsEnabled = false;
        }

        [CompilerGenerated]
        private void h(object A_0)
        {
            this.f.IsEnabled = true;
        }

        [CompilerGenerated]
        private void i(object A_0)
        {
            base.Close();
        }

        private void imgPayment_MouseLeftButtonUp(object A_0, MouseButtonEventArgs A_1)
        {
            if (a9 == null)
            {
                a9 = new ThreadStart(ManagementWindow.a);
            }
            new Thread(a9) { IsBackground = true }.Start();
        }

        private void imgRefresh_MouseLeftButtonUp(object A_0, MouseButtonEventArgs A_1)
        {
            this.d.Send(new SendOrPostCallback(this.g), null);
            new Thread(new ParameterizedThreadStart(this.f)) { IsBackground = true }.Start(null);
        }

        [DebuggerNonUserCode]
        public void InitializeComponent()
        {
            if (!this.a6)
            {
                this.a6 = true;
                Uri resourceLocator = new Uri("/TheSafety;component/managementwindow.xaml", UriKind.Relative);
                Application.LoadComponent(this, resourceLocator);
            }
        }

        [CompilerGenerated]
        private static void j(object A_0)
        {
            ConfigManager.i();
        }

        [CompilerGenerated]
        private void k(object A_0)
        {
            this.f.IsEnabled = false;
        }

        [CompilerGenerated]
        private void l(object A_0)
        {
            SendOrPostCallback d = null;
            this.d.Send(new SendOrPostCallback(this.k), null);
            string[] strArray = (string[]) A_0;
            string[] strArray2 = WebRequestManager.a(strArray[0], strArray[1], strArray[2], strArray[3], strArray[4], strArray[5], strArray[6], strArray[7]);
            if (strArray2 != null)
            {
                if (!string.IsNullOrWhiteSpace(strArray2[1]))
                {
                    MessageBox.Show(strArray2[1]);
                }
                else
                {
                    MessageBox.Show(strArray2[0]);
                    if (a8 == null)
                    {
                        a8 = new SendOrPostCallback(ManagementWindow.j);
                    }
                    this.d.Send(a8, null);
                    if (d == null)
                    {
                        d = new SendOrPostCallback(this.i);
                    }
                    this.d.Send(d, null);
                }
            }
            this.d.Send(new SendOrPostCallback(this.h), null);
        }

        [CompilerGenerated]
        private void m(object A_0)
        {
            this.f.IsEnabled = true;
        }

        [CompilerGenerated]
        private void n(object A_0)
        {
            this.d();
        }

        [CompilerGenerated]
        private void o(object A_0)
        {
            this.e();
        }

        private void OnSubscribtion_SelectionChanged(object A_0, SelectionChangedEventArgs A_1)
        {
            if ((A_0 as ComboBox).SelectedIndex > -1)
            {
                if ((A_0 as ComboBox).Name == this.v.Name)
                {
                    KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> tag = (KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>) (this.v.SelectedValue as ComboBoxItem).Tag;
                    Dictionary<string, ManagementPromoItemPeriod> dictionary = tag.Value;
                    this.x.Items.Clear();
                    foreach (KeyValuePair<string, ManagementPromoItemPeriod> pair in dictionary)
                    {
                        ComboBoxItem newItem = new ComboBoxItem {
                            Content = pair.Value.c(),
                            Tag = pair
                        };
                        this.x.Items.Add(newItem);
                    }
                    this.x.SelectedIndex = 0;
                }
                this.c();
            }
        }

        [CompilerGenerated]
        private void p(object A_0)
        {
            this.@as.Visibility = Visibility.Collapsed;
        }

        [CompilerGenerated]
        private void q(object A_0)
        {
            this.au.Content = this.e.b() + " USD";
        }

        [CompilerGenerated]
        private void r(object A_0)
        {
            this.h.Content = this.h.Content.ToString() + ":  " + this.e.a() + " $";
        }

        private void rStVPN_Click(object A_0, RoutedEventArgs A_1)
        {
            this.t.IsEnabled = true;
            this.v.Items.Clear();
            bool flag = false;
            if (this.t.IsChecked.HasValue && this.t.IsChecked.Value)
            {
                if (ba == null)
                {
                    ba = new Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool>(ManagementWindow.e);
                }
                foreach (KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> pair in this.e.c().Where<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>>(ba))
                {
                    ComboBoxItem newItem = new ComboBoxItem {
                        Content = pair.Key.a(),
                        Tag = pair
                    };
                    this.v.Items.Add(newItem);
                    if (!flag)
                    {
                        this.v.SelectedIndex = 0;
                        flag = true;
                    }
                }
            }
            else
            {
                if (bb == null)
                {
                    bb = new Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool>(ManagementWindow.d);
                }
                foreach (KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> pair2 in this.e.c().Where<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>>(bb))
                {
                    ComboBoxItem item2 = new ComboBoxItem {
                        Content = pair2.Key.a(),
                        Tag = pair2
                    };
                    this.v.Items.Add(item2);
                    if (!flag)
                    {
                        this.v.SelectedIndex = 0;
                        flag = true;
                    }
                }
            }
            this.r.Visibility = Visibility.Visible;
        }

        private void rVipN_Click(object A_0, RoutedEventArgs A_1)
        {
            this.t.IsEnabled = false;
            this.t.IsChecked = false;
            this.v.Items.Clear();
            bool flag = false;
            if (bc == null)
            {
                bc = new Func<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>, bool>(ManagementWindow.c);
            }
            foreach (KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>> pair in this.e.c().Where<KeyValuePair<ManagementPromoItemSub, Dictionary<string, ManagementPromoItemPeriod>>>(bc))
            {
                ComboBoxItem newItem = new ComboBoxItem {
                    Content = pair.Key.a(),
                    Tag = pair
                };
                this.v.Items.Add(newItem);
                if (!flag)
                {
                    this.v.SelectedIndex = 0;
                    flag = true;
                }
            }
            this.r.Visibility = Visibility.Collapsed;
        }

        [CompilerGenerated]
        private void s(object A_0)
        {
            this.f.IsEnabled = false;
        }

        [CompilerGenerated]
        private void t(object A_0)
        {
            SendOrPostCallback d = null;
            SendOrPostCallback callback2 = null;
            SendOrPostCallback callback3 = null;
            SendOrPostCallback callback4 = null;
            SendOrPostCallback callback5 = null;
            this.d.Send(new SendOrPostCallback(this.s), null);
            this.e = WebRequestManager.d();
            if (this.e != null)
            {
                if (d == null)
                {
                    d = new SendOrPostCallback(this.r);
                }
                this.d.Send(d, null);
                if (this.e.b() != null)
                {
                    if (callback2 == null)
                    {
                        callback2 = new SendOrPostCallback(this.q);
                    }
                    this.d.Send(callback2, null);
                }
                else
                {
                    if (callback3 == null)
                    {
                        callback3 = new SendOrPostCallback(this.p);
                    }
                    this.d.Send(callback3, null);
                }
                if (callback4 == null)
                {
                    callback4 = new SendOrPostCallback(this.o);
                }
                this.d.Send(callback4, null);
                if (callback5 == null)
                {
                    callback5 = new SendOrPostCallback(this.n);
                }
                this.d.Send(callback5, null);
            }
            this.d.Send(new SendOrPostCallback(this.m), null);
        }

        private void tabs_SelectionChanged(object A_0, SelectionChangedEventArgs A_1)
        {
            if (((A_1.AddedItems.Count > 0) && (A_1.AddedItems[0] is TabItem)) && (A_1.AddedItems[0] as TabItem).Equals(this.a3))
            {
                this.b();
            }
        }

        private void txtLogin_KeyUp(object A_0, KeyEventArgs A_1)
        {
            string text = (A_0 as TextBox).Text;
            this.a = false;
            if (!string.IsNullOrWhiteSpace(text))
            {
                this.ah.Visibility = Visibility.Visible;
                Regex regex = new Regex("^[a-z0-9]{6,15}$");
                if (regex.IsMatch(text))
                {
                    this.ah.Source = new BitmapImage(new Uri("pack://application:,,,/thesafety;component/Resources/accept.png"));
                    this.a = true;
                }
                else
                {
                    this.ah.Source = new BitmapImage(new Uri("pack://application:,,,/thesafety;component/Resources/delete.png"));
                }
            }
        }

        private void txtPass_KeyUp(object A_0, KeyEventArgs A_1)
        {
            string password = (A_0 as PasswordBox).Password;
            this.b = false;
            if (!string.IsNullOrWhiteSpace(password))
            {
                this.ai.Visibility = Visibility.Visible;
                Regex regex = new Regex("^[a-z0-9]{6,15}$");
                if (regex.IsMatch(password))
                {
                    this.ai.Source = new BitmapImage(new Uri("pack://application:,,,/thesafety;component/Resources/accept.png"));
                    this.b = true;
                }
                else
                {
                    this.ai.Source = new BitmapImage(new Uri("pack://application:,,,/thesafety;component/Resources/delete.png"));
                }
            }
        }

        private void txtPromo_KeyUp(object A_0, KeyEventArgs A_1)
        {
            Func<string, bool> predicate = null;
            Func<string, bool> func2 = null;
            this.c = "";
            string a = (A_0 as TextBox).Text;
            if (!string.IsNullOrWhiteSpace(a) && (this.e != null))
            {
                <>c__DisplayClass4f classf;
                this.aa.Visibility = Visibility.Visible;
                if (predicate == null)
                {
                    predicate = new Func<string, bool>(classf.b);
                }
                if (this.e.d().Keys.Count<string>(predicate) > 0)
                {
                    if (func2 == null)
                    {
                        func2 = new Func<string, bool>(classf.c);
                    }
                    this.c = this.e.d()[this.e.d().Keys.Single<string>(func2)];
                    this.aa.Source = new BitmapImage(new Uri("pack://application:,,,/thesafety;component/Resources/accept.png"));
                }
                else
                {
                    this.aa.Source = new BitmapImage(new Uri("pack://application:,,,/thesafety;component/Resources/delete.png"));
                }
            }
            else
            {
                this.aa.Visibility = Visibility.Hidden;
            }
            this.c();
        }

        private void Window_Loaded(object A_0, RoutedEventArgs A_1)
        {
            this.d = SynchronizationContext.Current;
            new Thread(new ParameterizedThreadStart(this.t)) { IsBackground = true }.Start(null);
        }
    }
}

